import { memo } from 'react';
import { Spin } from 'antd';
import { LoadingOutlined } from '@ant-design/icons';
/**
 * 用于组件懒加载时显示Loading效果
 * @param size 尺寸
 * @returns 返回Loading组件
 */
const SpinLoading = ({
  size = 'default',
  style,
}: {
  size?: 'default' | 'small' | 'large';
  style?: React.CSSProperties;
}) => {
  return (
    <Spin
      indicator={
        <LoadingOutlined
          style={{ fontSize: 48, color: '#a4f4cf' }}
          spin
        />
      }
      size={size}
      style={{
        width: '100%',
        height: '100%',
        display: 'flex',
        alignItems: 'center',
        justifyContent: 'center',
        marginTop: 30,
        ...style,
      }}
    />
  );
};

export default memo(SpinLoading);
